/**
 * 文件名称:  ShadeAction.java
 * 文件版权:  SunShade Technologies Co., Ltd. Copyright 2000-2020,  All rights reserved
 * 文件描述:  <描述>
 * 修改作者:  LiXiangDong
 * 修改时间:  Jan 10, 2013
 * 修改单号:  <修改单号>
 * 修改内容:  <修改内容>
 */
package com.sunshade.common.struts;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;

/**
 * 
 * @author  LiXiangDong
 * @version V1.0, Jan 10, 2013
 */
public class ShadeAction extends ActionSupport
{
    
    /** 注释内容 */
    private static final long serialVersionUID = 4945796546542752564L;
    
    public void client()
    {
        HttpServletResponse response = ServletActionContext.getResponse();
        response.setHeader("Pragma", "No-cache");
        response.setHeader("Cache-Control", "no-cache");
        response.setDateHeader("Expires", 0);
    }
    
    /**
     * 获取request对象
     * @return HttpServletRequest Request对象
     */
    public HttpServletRequest getRequest()
    {
        HttpServletRequest request = ServletActionContext.getRequest();
        return request;
    }
    
    /**
     * 获取response对象
     * @return HttpServletResponse Response对象
     */
    public HttpServletResponse getResponse()
    {
        HttpServletResponse response = ServletActionContext.getResponse();
        return response;
    }
    
    /**
     * 获取Session对象
     * @return HttpSession Session对象
     */
    public HttpSession getSession()
    {
        HttpSession session = getRequest().getSession();
        return session;
    }
    
    /**
     * 获取输出对象
     * @return PrintWriter 输出对象
     * @throws IOException IO异常
     */
    public PrintWriter getPrintWrite()
        throws IOException
    {
        HttpServletResponse response = getResponse();
        response.setContentType("text/html;charset=utf-8");
        return response.getWriter();
    }
    
}
